package com.ruoyi.hqfinance.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.hqfinance.domain.HqTransferExamineSettleSheet;
import com.ruoyi.hqfinance.domain.vo.HqTransferExamineSettleSheetVo;
import com.ruoyi.hqfinance.service.HqTransferExamineSettleSheetService;
import com.ruoyi.logistic.domain.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/hq/transferExamineSettleSheet")
@Api(tags = "总部财务-中转考核结算报表")
public class HqTransferExamineSettleSheetController {
    @Autowired
    private HqTransferExamineSettleSheetService hqTransferExamineSettleSheetService;

    @ApiOperation("汇总")
    @PostMapping("/collect")
    public R collect(@RequestBody HqTransferExamineSettleSheetVo vo){
        List<HqTransferExamineSettleSheet> settleSheets = hqTransferExamineSettleSheetService.collect(vo);
        if (settleSheets == null || settleSheets.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(PageInfo.info(settleSheets));
        }
    }
}
